package com.speechb.common.jpush;
/*
import cn.jiguang.common.ClientConfig;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Message;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.audience.AudienceTarget;*/

/**
 * @author root 2018/09/14
 */
public class JpushController {
    /*private final static String MASTER_SECRET="94ba347ff8fb911635bb05b6";
    private final static String APP_KEY="86d8093860519a361b359f93";
    private static   JPushClient jpushClient;
    public static JPushClient getInstance(){
        if(jpushClient==null){
            jpushClient = new JPushClient(MASTER_SECRET, APP_KEY, null, ClientConfig.getInstance());
        }
        return jpushClient;
    }
    public static void pushMsg(String msg)throws Exception{

        // For push, all you need do is to build PushPayload object.
        PushPayload payload = buildPushObject("测试啊");

            PushResult result = jpushClient.sendPush(payload);
            System.out.println("result.getResponseCode() = " + result.getResponseCode());

    }
    public static PushPayload buildPushObject(String content) {
        return PushPayload.newBuilder()
                .setPlatform(Platform.android_ios())
                .setAudience(Audience.newBuilder()
                       *//* .addAudienceTarget(AudienceTarget.tag("tag1", "tag2"))*//*
                        .addAudienceTarget(AudienceTarget.alias("test", "alias2"))
                        .build())
                .setMessage(Message.newBuilder()
                        .setMsgContent(content)
                        .addExtra("from", "JPush")
                        .build())
                .build();
    }*/
}
